{extend name="../../admin/view/main"}

{block name="button"}
<!--{if auth("add")}-->
<button data-modal='{:url("add")}' data-title="添加分类" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
<!--{/if}-->

{/block}

{block name="content"}
<div class="think-box-shadow table-block">
    {empty name='list'}
    <blockquote class="layui-elem-quote">没 有 记 录 哦！</blockquote>
    {else}
    <div class="think-box-shadow">
        <form autocomplete="off" onsubmit="return false;" data-auto="true" method="post" onsubmit="return false" >
            <input type="hidden" value="resort" name="action"/>
            <table class="layui-table margin-top-10" lay-skin="line">
                <thead>
                <tr>
                    <th class='text-left nowrap'>ID</th>
                    <th class='text-left nowrap'>菜单名称</th>
                    <th class='text-left nowrap'>菜单图片地址</th>
                    <th class='text-left nowrap'>跳转规则</th>
                    <th class='text-left nowrap'>状态</th>
                    <th class='text-left nowrap'>创建时间</th>
                    <td class='text-left nowrap'>操作 </td>
                    <th class='text-left'></th>
                </tr>
                </thead>
                {foreach $list as $key=>$vo}
                <tbody>
                <tr>
                    <td class='text-left nowrap'>{$vo.id}</td>
                    <td class='text-left nowrap'>{$vo.menuname}</td>
                    <td>
                    <div class="headimg" data-tips-image data-lazy-src="{$vo.img|default=''}"></div>
                    </td>
                    <td class='text-left nowrap'>
                        <p>{$vo.imgurl}</p>
                        {notempty name="vo.mini_appid"}
                        <p>跳转小程序appId: {$vo.mini_appid}</p>
                        {/notempty}
                    </td>
                    <td class='text-left nowrap'>{if $vo.status eq 1}有效{else}<span style="color: red"> 无效</span>{/if}</td>
                    <td class='text-left nowrap'>{$vo.create_at}</td>
                    <td class='text-left'>
                        {if auth("edit")}
                        <a data-dbclick class="layui-btn layui-btn-xs" data-title="编辑分类" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
                        {/if}

                        {if auth("status") and $vo.status eq 1}
                        <a class="layui-btn layui-btn-xs layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#0">禁 用</a>
                        {/if}
                        {if auth("status") and $vo.status eq 0}
                        <a class="layui-btn layui-btn-xs layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#1">启 用</a>
                        {/if}

                        {if auth("remove")}
                        <a class="layui-btn layui-btn-danger layui-btn-xs" data-confirm="确定要删除数据吗?" data-action="{:url('del')}?id={$vo.id}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
                        {/if}
                    </td>
                </tr>
                </tbody>
                {/foreach}
            </table>
        </form>
    </div>
        </tbody>
    </table>
    {/empty}
</div>
{/block}
